project(TrainingBook)
cmake_minimum_required(VERSION 2.8)
ENABLE_TESTING()
include (version.cmake)
message(STATUS "*** Building TrainingBook ${TrainingBook_VERSION} ***")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

find_package(PkgConfig REQUIRED)

#REMARQUE : il semble que l'exécution de CMake ne prévient pas si le paquet gtkmm (ou une autre ?) est manquant ==> du coup le CMake perd pas mal de son intérêt
pkg_check_modules(GTKMM REQUIRED gtkmm-2.4)
pkg_check_modules(LIBXMLPP REQUIRED libxml++-2.6)
pkg_check_modules(CURL REQUIRED libcurl)

if(NOT CMAKE_BUILD_TYPE)
  set (CMAKE_BUILD_TYPE RELEASE)
endif(NOT CMAKE_BUILD_TYPE)

set(LIBRARY_OUTPUT_PATH ${TrainingBook_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${TrainingBook_BINARY_DIR}/bin)

message(STATUS "Build type is ${CMAKE_BUILD_TYPE}")

include_directories(${LIBXMLPP_INCLUDE_DIRS} ${GTKMM_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} include)

link_directories(${LIBXMLPP_LIBRARY_DIRS} ${GTKMM_LIBRARY_DIRS} ${CURL_LIBRARY_DIRS})


subdirs(src doc include test)


set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")




# file(
#     GLOB_RECURSE
#     source_files
#     src/*
# )
# 
# # Déclaration de l'exécutable
# add_executable(
#     bin/TrainingBook
#     ${source_files}
# )
# 
# SET_TARGET_PROPERTIES(bin/TrainingBook PROPERTIES COMPILE_FLAGS ${LIBXMLPP_CFLAGS} COMPILE_FLAGS "${GTKMM_CFLAGS}"+"${CURL_CFLAGS}")
# 
# target_link_libraries(
#         bin/TrainingBook
#         ${LIBXMLPP_LIBRARIES}
#         ${GTKMM_LIBRARIES}
#         ${CURL_LIBRARIES}
#)


